#pragma once
#include "GameScreen.hpp"
#include "Frame.h"
#include "Events.hpp"
#include "GameSettings.h"

class MenuScreen :
	public rh::GameScreen
{
private:
	enum MenuState
	{
		PlayersSelection,
		DifficultySelection
	};

	GameSettings _gameSettings;
	MenuState _menuState;

	sf::Texture _mainTexture;
	rh::Frame _background;
	rh::Frame _difficultiesCursor;
	rh::Frame _difficulties[3];
	rh::Frame _playersCursor;
	rh::Frame _players[2];
	rh::Frame _cursor;

	void ManagePlayerSelection(const sf::Time& elapsedTime, const sf::Time& totalElapsedTime);
	void ManageDifficultySelection(const sf::Time& elapsedTime, const sf::Time& totalElapsedTime);
	void HandlePlayerInput(void);
	void HandleDifficultyInput(void);
	void MoveCursor(void);
	void UpdateMenu(void);

public:
	rh::Event<void, GameSettings> SettingsUpdated;
	MenuScreen(void);
	~MenuScreen(void);

	virtual void Draw(sf::RenderWindow& renderWindow, const sf::RenderStates & renderState);
	virtual void Update(const sf::Time& elapsedTime, const sf::Time& totalElapsedTime);
	virtual void Initialize(void);
};

